#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/12/27 17:20
# @Author: 周健
# @Email: 907614893@qq.com
# @File：user_page.py
from pages.base_page import BasePage
from appium.webdriver.common.mobileby import MobileBy as By

class UserPage(BasePage):
    user_locator = (By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerView\"]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]')
    user_message_locator= (By.XPATH,'//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/tv_nickName\"]')

    # 点击第一个用户
    def click_user(self):
        self.driver.find_element(*self.user_locator).click()
    # 获取用户的昵称
    def get_user_text(self):
        return self.driver.find_element(*self.user_message_locator).text